package forward.Module.Modules.Move;

import forward.Client;
import forward.api.EventHandler;
import forward.api.Events.World.EventPreUpdate;
import forward.api.Value.Option;
import forward.Module.Module;
import forward.Module.ModuleType;

import java.awt.Color;

public class Sprint extends Module {
	private Option<Boolean> omni = new Option<Boolean>("All-Direction", "All-Direction", false);

	public Sprint() {
		super("Sprint", new String[] { "run" }, ModuleType.Move);
		this.setColor(new Color(158, 205, 125).getRGB());
		this.addValues(this.omni);
	}

	@EventHandler
	private void onUpdate(EventPreUpdate event) {
		if (this.mc.thePlayer.getFoodStats().getFoodLevel() > 6 && this.omni.getValue() != false
				? this.mc.thePlayer.moving()
				: this.mc.thePlayer.moveForward > 0.0f) {
			if(!(Client.instance.getModuleManager().getModuleByClass(Scaffold.class).isEnabled()&&mc.gameSettings.keyBindSprint.isKeyDown())) {
				this.mc.thePlayer.setSprinting(true);
			}
		}
	}
}